/**
 * Created by xiebang
 * Description
 * User:小谢
 * Date:2021-08-02
 * Time:19:54
 */

public class TestDemo {
    private int num1;
    private int num2;

    public int getNum1() {
        return num1;
    }

    public void setNum1(int num1) {
        this.num1 = num1;
    }

    public int getNum2() {
        return num2;
    }

    public void setNum2(int num2) {
        this.num2 = num2;
    }
    public int add (){
        return this.num1 + this.num2;
    }
    public int sub() {
        return this.num1 - this.num2;
    }
    public int mul() {
        return  this.num1 * this.num2;
    }
    public double dev() {
        return (double) this.num1 / this.num2;
    }
}
//交换变量的值
//如果是简单类型不能交换，原因是：普通类型是拿不到地址的
//处理的核心思想是拿到变量的地址。
//引用类型  new 数字（）；
class MyValue {
//    public int val;
    private int val;

    public int getVal() {
        return val;
    }

    public void setVal(int val) {
        this.val = val;
    }
}
class TestDemo1 {
    public static void swap(MyValue myValue1, MyValue myValue2) {
        int tmp = myValue1.getVal();
        myValue1.setVal(myValue2.getVal());
        myValue2.setVal(tmp);
    }
    public static void main(String[] args) {
        MyValue myValue1 = new MyValue();
        MyValue myValue2 = new MyValue();
        myValue1.setVal(10);
        myValue2.setVal(20);
        System.out.println(myValue1.getVal());
        System.out.println(myValue2.getVal());
        swap(myValue1,myValue2);
        System.out.println("===================");
        System.out.println(myValue1.getVal());
        System.out.println(myValue2.getVal());
    }
//    public static void main(String[] args) {
//        MyValue myValue1 = new MyValue();
//        MyValue myValue2 = new MyValue();
//        myValue1.val = 10;
//        myValue2.val = 20;
//        System.out.println(myValue1.val);
//        System.out.println(myValue2.val);
//        swap(myValue1,myValue2);
//        System.out.println("===================");
//        System.out.println(myValue1.val);
//        System.out.println(myValue2.val);
//    }
    public static void main1(String[] args) {
        TestDemo testDemo = new TestDemo();
        testDemo.setNum1(10);
        testDemo.setNum2(20);
        System.out.println(testDemo.add());
        System.out.println(testDemo.sub());
        System.out.println(testDemo.mul());
        System.out.println(testDemo.dev());
    }
}
//class Test {
//    public static void hello() {
//        System.out.println("hello");
//    }
//}
//public class TestDemo {
//    public static void main(String[] args) {
//        // TODO Auto-generated method stub
//        Test test=null;
//        test.hello();
//    }
//}
// class Person{
//
//    private String name = "Person";
//
//    int age=0;
//
//}
//
//public class Child extends Person{
//
//    public String grade;
//
//    public static void main(String[] args){
//
//        Person p = new Child();
//
//        System.out.println(p.name);
//
//    }
//
//}
//class Test {
//    public int aMethod() { int i = 0;
//        i++;
//        return i;
//    }
//}
//public class TestDemo {
//    static boolean Paddy;
//    public static void main(String args[]){
//        System.out.println(Paddy);
//    }
//        public static void main2(String args[]) {
//            Test test = new Test();
//            test.aMethod();
//            int j = test.aMethod();
//            System.out.println(j);
//        }
//
//    public static void main1(String[] args) {
//        String s;
//        System.out.println("s = ");
//    }
//}
